package org.zhadoop.stream.cql.semanticanalyzer.parser.visitor;

import org.antlr.v4.runtime.misc.NotNull;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.BitExpressionContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.CQLParser.RelationOperatorContext;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.RelationExpressionContext;

/**
 * 关系表达式语法遍历
 * 
 * @author zwd
 *
 */
public class RelationExpressionVisitor extends AbsCQLParserBaseVisitor<RelationExpressionContext> {

	private RelationExpressionContext context = null;

	public RelationExpressionVisitor() {
		context = new RelationExpressionContext();
	}

	@Override
	protected RelationExpressionContext defaultResult() {
		return context;
	}

	@Override
	public RelationExpressionContext visitRelationOperator(@NotNull RelationOperatorContext ctx) {
		context.setRelationOperator(ctx.getText());
		return context;
	}

	@Override
	public RelationExpressionContext visitBitExpression(@NotNull BitExpressionContext ctx) {
		BitExpressionVisitor visitor = new BitExpressionVisitor();
		context.setBitExpression(visitor.visit(ctx));
		return context;
	}

}
